<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('还款计划列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <input id="loanId" name="loanId" th:value="${loanId}" type="hidden">
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="loans:loansLog:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="loans:loansLog:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="loans:loansLog:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="loans:loansLog:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('loans:paymentDetail:edit')}]];
    var removeFlag = [[${@permission.hasPermi('loans:paymentDetail:remove')}]];
    var prefix = ctx + "loans/paymentDetail";
    var loanId = $("#loanId").val();
    $(function() {
        var options = {
            url: prefix + "/list?loanId="+loanId,
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "还款计划",
            showExport: true,
            pageSize: 12,
            showSearch: false,
            cardView: true,
            columns: [
            //     {
            //     checkbox: true
            // },
                {
                    title: "期数",
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'paymentAverage',
                    title : '还款总额'
                },
                {
                    field : 'paymentInterest',
                    title : '还款利息'
                },
                {
                    field : 'paymentPrincipal',
                    title : '还款本金'
                },
                {
                    field : 'paymentTime',
                    title : '还款时间'
                }
                ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>